import 'package:bxultimate/widgets/mk_page.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import 'package:webview_flutter/webview_flutter.dart';

import 'controller.dart';

class MkWebviewPage extends StatefulWidget {
  const MkWebviewPage({Key? key}) : super(key: key);

  @override
  State<MkWebviewPage> createState() => _MkWebviewPageState();
}

class _MkWebviewPageState extends State<MkWebviewPage> {
  final controller = Get.find<MkWebviewController>();
  final state = Get.find<MkWebviewController>().state;

  @override
  Widget build(BuildContext context) {
    return MkPage(
        child: Obx(() => Scaffold(
          backgroundColor: Colors.transparent,
              appBar: TDNavBar(
                backgroundColor: Colors.transparent,
                title: state.title,
              ),
              body: SafeArea(
                child: WebViewWidget(
                  controller: controller.webViewController,
                ),
              ),
            )));
  }

  @override
  void dispose() {
    Get.delete<MkWebviewController>();
    super.dispose();
  }
}
